﻿namespace EasyIot.WinApp
{
    public class CProtocolAnalysis
    {
        public enum EBagStatus
        {
            BagNone,    // 正常
            BagLost,    // 掉包
            BagStick    // 粘包
        }

        public EBagStatus BagStatus { get; set; }
        public bool WhetherAddContact { get; set; }
        public bool WhetherToSend { get; set; }
        public int Cmd { get; set; }
        public string Uid { get; set; }
        public byte[] SendBuffer { get; set; }
        public string TaskId { get; set; }
        public string Msg { get; set; }

        public bool IsRemainData(int iPosition, ByteBuffer bBuffer, CProtocolAnalysis analysis)
        {
            if (bBuffer.WaitRecvRemain)
            {
                bBuffer.Position = iPosition;
                analysis.BagStatus = EBagStatus.BagLost;
                return false;
            }
            return true;
        }
    }
}
